/*工程流程*/
'use strict';
const progressListQueryAction = require('../actions/progress/progressListQueryAction');
const progressQueryAction = require('../actions/progress/progressQueryAction');
const progressAddAction = require('../actions/progress/progressAddAction');
const progressDelAction = require('../actions/progress/progressDelAction');
const progressUpdateAction = require('../actions/progress/progressUpdateAction');
const progressOtherUpdateAction = require('../actions/progress/progressOtherUpdateAction');
const progressOtherQueryAction = require('../actions/progress/progressOtherQueryAction');
const progressFinishAction = require('../actions/progress/progressFinishAction');
const progressTestQuery = require('../actions/progress/completion/progressTestQueryAction');
const progressTestUpdate = require('../actions/progress/completion/progressTestUpdateAction');
const progressCompletionFinish = require('../actions/progress/completion/progressCompletionTestAction');
module.exports = async function (ctx) {
    let param = ctx.method === 'GET' ? ctx.query : ctx.request.fields;
    let action_type = param.action_type;
    try {
        switch (action_type) {
            case 'progressListQuery': // 工程流程查询
                ctx.body = await progressListQueryAction(param);
                break;
            case 'progressQuery': // 工程流程内容查询
                ctx.body = await progressQueryAction(param);
                break;
            case 'progressAdd': // 工程流程内容添加
                ctx.body = await progressAddAction(param);
                break;
            case 'progressDel': // 工程流程内容删除
                ctx.body = await progressDelAction(param);
                break;
            case 'progressUpdate': // 工程流程内容修改
                ctx.body = await progressUpdateAction(param);
                break;
            case 'progressOtherUpdate': // 工程流程中其他内容修改
                ctx.body = await progressOtherUpdateAction(param);
                break;
            case 'progressOtherQuery': // 工程流程中其他内容查询
                ctx.body = await progressOtherQueryAction(param);
                break;
            case 'progressFinish': // 工程流程中完成
                ctx.body = await progressFinishAction(param);
                break;
            case 'progressTestQuery': // 竣工初验查询
                ctx.body = await progressTestQuery(param);
                break;
            case 'progressTestUpdate': // 工程流程初检内容修改
                ctx.body = await progressTestUpdate(param);
                break;
            case 'progressCompletionFinish': // 工程竣工检验和备案
                ctx.body = await progressCompletionFinish(param);
                break;
        }
    } catch (e) {
        ctx.body = {success: false, message: e.message};
    }

};